Skip to content

PYTHON-5002 Add guard to synchro hook to accidental overwrite #2026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Dec 4, 2024

Conversation

blink1073
Copy link
Member

Example output:

synchro..................................................................Failed
- hook id: synchro
- exit code: 1

Refusing to overwrite ./pymongo/synchronous/mongo_client.py
Traceback (most recent call last):
  File "/Users/steve.silvester/workspace/mongo-python-driver/./tools/synchro.py", line 380, in <module>
    main()
  File "/Users/steve.silvester/workspace/mongo-python-driver/./tools/synchro.py", line 371, in main
    raise ValueError("Aborting synchro due to errors")
ValueError: Aborting synchro due to errors

@blink1073 blink1073 requested a review from NoahStapp December 3, 2024 23:18
modified_files = [f"./{f}" for f in sys.argv[1:]]
errored = False
for fname in async_files + gridfs_files:
if str(fname) in modified_files:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we change this to check that the async name is not in modified files? This code is a little confusing to read.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment

@blink1073 blink1073 requested a review from NoahStapp December 4, 2024 15:21
@blink1073 blink1073 merged commit 5204e87 into mongodb:master Dec 4, 2024
28 of 30 checks passed
@blink1073 blink1073 deleted the PYTHON-5002 branch December 4, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants